<!DOCTYPE html>
<html lang="zh-cn" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8" />
    <title>新增菜单</title>
</head>
<body>
<div th:replace="/layout/css :: #css"></div>
<div class="container-fluid" style="width: 400px;">
    <form id="createForm" method="post" class="form-horizontal modal-form">
        <input id="id" name="id" th:type="hidden" th:value="${menuModel.id}" />
        <input id="systemId" name="systemId" th:type="hidden" th:value="${menuModel.systemId}" />
        <input id="pid" name="pid" th:type="hidden" th:value="${menuModel.pid}" />
        <div class="form-group">
            <label for="name" class="control-label">名称</label>
            <input id="name" name="name" type="text" class="form-control" th:value="${menuModel.name}" />
        </div>
        <div class="form-group">
            <label for="url" class="control-label">路径</label>
            <input id="url" name="url" type="text" class="form-control" th:value="${menuModel.url}" />
        </div>
        <div class="form-group">
            <label for="orders" class="control-label">序号</label>
            <input id="orders" name="orders" type="text" class="form-control" th:value="${menuModel.orders}" />
        </div>
        <br />
        <button type="button" class="btn btn-primary btn-block" onclick="doCreate()">保 存</button>

    </form>

</div>

<script type="text/javascript" th:src="@{/js/modalPage.js}"></script>

<script>
    function doCreate(){
        $.ajax({
            type: 'post',
            url: '/menu/update',
            data: $('#createForm').serialize(),
            success: function(result) {
                if (result.status != 0) {
                    failHandler(result);
                } else {
                    successConfirm();
                    closeModal();
                }
            },
            error: errorHandler
        });
    }
</script>
</body>
</html>